package com.sharp.oss.dao.repository;

import com.sharp.kernel.constant.db.SqlConstant;
import com.sharp.kernel.mybatis.repository.BaseMysqlRepository;
import com.sharp.oss.dao.entity.SaObjectStorage;
import com.sharp.oss.dao.mapper.SaObjectStorageDao;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * Title: SaObjectStorageService
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2019/11/13 9:23
 */
@Service
public class SaObjectStorageService extends BaseMysqlRepository<SaObjectStorage, SaObjectStorageDao> {

    @Resource
    private SaObjectStorageDao saObjectStorageDao;

    public SaObjectStorage getSaObjectStorageByFileName(String fileName) {
        Example example = super.getExample();
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("name", fileName);
        criteria.andEqualTo(SqlConstant.VALID_FIELD, SqlConstant.VALID);
        return super.selectOne(example);
    }
}




